<?php
/**
 * @version		$Id: almhoster.php 7 2011-12-22 13:48:09Z netix.mail@gmail.com $
 * @package		ALM Hoster
 * @desription	Web hosting and domain menager for resellers
 * @subpackage	Components
 * @copyright	Copyright (C) 2011 ALM Studio. All rights reserved.
 * @author		ALM Studio
 * @email		info@alm-studio.net
 * @link		http://alm-studio.net
 * @license		Commercial
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.modellist');

class AlmHosterModelAlmHoster extends JModelList
{
	
	public function &getInvoices()
	{

		$db		= $this->getDbo();
		$query	= $db->getQuery(true);
		$query->select('InvoiceStatus, COUNT(InvoiceId) AS ukupno');
		$query->from('#__almh_invoices');
		$query->group('InvoiceStatus');
		$db->setQuery($query);	
		$db->setQuery((string) $query);
			if (!$db->query()) {
				JError::raiseError(500, $db->getErrorMsg());
			}			
		$this->_invoices = $db->loadObjectList();
			
		return $this->_invoices;
		
	}
	
	public function &getOrders()
	{

		$db		= $this->getDbo();
		$query	= $db->getQuery(true);
		$query->select('OrderStatus, COUNT(OrderId) AS total');
		$query->from('#__almh_orders');
		$query->group('OrderStatus');

		$db->setQuery($query);
		
		$db->setQuery((string) $query);

			if (!$db->query()) {
				JError::raiseError(500, $db->getErrorMsg());
			}
			
		$this->_orders = $db->loadObjectList();
	
		return $this->_orders;
	}
}
?>